In `man fs_snapshot_create` is stated "All snapshot functions require superuser privileges and also require an additional entitlement."Which entitlement is it?Background:I want to write a tool to create snapshots without `tmutil localsnapshot /` because I noticed that these snapshots are deleted randomly. So I had the idea to check if this only applies to snapshots created with `tmutil` or to APFS-snapshots in general... if it's `tmutil`-related I could circumvent it by using my own app – because for me snapshots are pretty useless if they vanish magically.
Post not yet marked as solved
I wrote an app which (as an accessibility client) is able to grab and translate scroll wheel events. I used this functionality to translate a left-tilt to F5 and a right-tilt to F6 (which then could be configured as shortcut; e.g. to switch between Spaces etc.).This is the code I used to capture the events (trimmed down to work in Playground):import Cocoa
import ApplicationServices
// The event callback
private func cEventCallback(_: OpaquePointer, _: CGEventType, event: CGEvent, additionalData: UnsafeMutableRawPointer?) -> Unmanaged<CGEvent>? {
print("Got event ", event, " with type ", event.type)
return Unmanaged<CGEvent>.passUnretained(event)
}
// Check if the process is a trusted accessibility client
if !AXIsProcessTrusted() {
print("Application is not a trusted Accessibility Client – crashing now^^")
print(" (For ScrollWheelMgr to work you need to add/enable it in \"System Preferences -> Security & Privacy -> Accessibility\")")
fatalError("Application is not a trusted Accessibility Client")
}
// Create tap and add it to runloop
let eventTap = CGEvent.tapCreate(
tap: CGEventTapLocation.cghidEventTap,
place: CGEventTapPlacement.headInsertEventTap,
options: CGEventTapOptions(rawValue: UInt32(0))!,
eventsOfInterest: CGEventMask(1 << NX_SCROLLWHEELMOVED | 1 << NX_OMOUSEDOWN),
callback: cEventCallback,
userInfo: nil
)
let runloopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0)
CFRunLoopAddSource(CFRunLoopGetCurrent(), runloopSource, CFRunLoopMode.commonModes)However in Catalina 10.15 Beta (19A471t) this code does not work as intended: scrolling up and down as well as a scroll-wheel clicks are still registered but tilt events are ignored now. Is there a new event mask that I can use to capture those events again?